const mysql = require('mysql');
const pool  = mysql.createPool({
  connectionLimit : 10,
  host            : 'localhost',
  user            : 'root',
  password        : 'root',
  database        : 'mi'
});
 
// pool.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
//   if (error) throw error;
//   console.log('The solution is: ', results[0].solution);
// });

function query(sql){
    return new Promise(function (resolve, reject) {
        pool.query(sql,(err, results) => {
            if(err) reject(err);
            resolve(results);
        })
    })
}

module.exports =query;